Skip to content

[feature] throw sql transform exception,locate error expression #9227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

misi1987107
Copy link
Contributor

Purpose of this pull request

resolve issue #9125

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@hailin0 hailin0 requested a review from Copilot April 27, 2025 01:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses issue #9125 by enhancing error handling in the SQL transformation logic. Key changes include:

  • Wrapping the SQL expression evaluation in a try-catch block to throw a more specific exception.
  • Introducing new exception classes and error codes to better pinpoint errors in SQL processing.
  • Adding new files for SqlTransformException and SqlTransformErrorCode to support the improved exception handling.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/ZetaSQLEngine.java Added exception handling for SQL expression evaluation and improved error reporting.
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/exception/SqlTransformException.java New exception class for SQL transformation errors.
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/exception/SqlTransformErrorCode.java New error code enum defining the SQL transformation error codes.
Comments suppressed due to low confidence (1)

seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/ZetaSQLEngine.java:295

  • Consider adding a space after the comma in the error message for improved readability, e.g., "Failed to execute sql expression, the error expression is %s".
String.format("Failed to execute sql expression,the error expression is %s", expression),

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants